﻿using ArtMath.CommonType;
using ArtMath.Resource;
using System.Windows.Forms;

namespace ArtMath.Command
{
    public class AddObject<T> : CommandBase where T : IRecoverableDelete
    {
        T obj;
        public AddObject(T obj)
        {
            this.obj = obj;
            UndoMenuItem = new ToolStripMenuItem($"{Resources.Translate("Delete")} \"{obj.Name}\"");
            RedoMenuItem = new ToolStripMenuItem($"{Resources.Translate("Add")} \"{obj.Name}\"");
        }
        public override int ObjectCount
        {
            get { return 1; }
        }
        public override void Redo()
        {
            obj.Recover();
        }
        public override void Undo()
        {
            obj.Delete(true);
        }
    }
}
